<style>
	.go_login,
	.go_register {
		display: none;
	}
	
	.go_out {
		cursor: pointer;
	}
	
	.ZZHT-header .ZZHT-nav .drop-infos.go_out a {
		color: #fff;
	}
	.ZZHT-cart-box .goods .number p{
		line-height: 17px;
	}
	.ZZHT-cart-boxs{
		left: -223px;
	}
	#j-goods>.price{
		padding-top:20px;
		padding-right:5px;
	}
	.ZZHT-header .ZZHT-nav .j-dorpdown,.ZZHT-header .ZZHT-nav .j-dorpdown .foucs-list{
		width:110px;
	}
</style>
<div class="ZZHT-header">
	<div class="ZZHT-nav">
		<ul class="headrf fl">
			
			<li class="drop-infos go_login">
				<div class="ZZHT-fred">
					<span style="color:#aaa">Hello!欢迎来到华猫商城 </span><a href="../view/login.html">请登录</a>
				</div>
			</li>
			<li class="drop-infos user_name">
				<div class="ZZHT-fred">
					<a href="../Usercenter/01.html" style="color:#aaa;">欢迎您 , <span style="color:red;">ljf</span></a>
				</div>
			</li>
			<li class="spacer"></li>
			<li class="drop-infos go_register">
				<div class="ZZHT-fred">
					<a href="../view/register.html">注册</a>
				</div>
			</li>
			<li class="drop-infos go_out">
				<div class="ZZHT-fred">
					<a>退出</a>
				</div>
			</li>
		</ul>
		<ul class="headrf fr">
			<!--<li class="drop-infos">
				<div class="ZZHT-fred">
					<a href="../view/index.html">华猫商城</a>
				</div>
			</li>-->
			<li class="j-dorpdown">
				<div class="drop-down">
					<img src="../images/index/huamao_03.png" alt="" class="dp_left top_phone" />
					<a href="#" target="_blank">手机华猫</a>
					<!--<img src="../images/index/huamao_05.png" alt="" class="dp_right" />-->
					<!--<img src="../img/store_icon_zk.png" alt="" class="dp_right" />-->
				</div>
				<div class='j-dorpdown-layer sweep-list'>
					<div class="qrcodea clearfix">
						<div id='qrcodea' class="qrcodeal"></div>
						<div class="qrcodear">
							<p>扫描二维码</p><span>下载手机客户端</span>
							<a>Android</a>
							<a>iPhone</a>
						</div>
						<div class="ZZHT-clear"></div>
					</div>
				</div>
			</li>
			<li class="spacer"></li>
			<li class="j-dorpdown">
				<div class="drop-down pdl5 userType_top">
					<a href="../Usercenter/01.html">用户中心 v</a>
					<!--<img src="../images/index/huamao_05.png" alt="" class="dp_right" />-->
				</div>
				<div class='j-dorpdown-layer foucs-list userType_content'>
					<div>
						<a href="../underLineShop/01.html">线下商家</a>
					</div>
					<div>
						<a href="../onLineShop/01.html">商城商家</a>
					</div>
					<div>
						<a href="../agencyCompany/01.html">代理公司</a>
					</div>
				</div>
			</li>
			<li class="spacer"></li>
			<li class="drop-infos">
				<a href='../Usercenter/13.html'>我的订单</a>
			</li>
			<li class="spacer"></li>
			<li class="j-dorpdown box">
				<div class="drop-down" style="text-align: right;">
					<a href='../carts/carts2.html'>购物车 ( <span class="goodsNum">0</span> )</a>
					<img src="../images/index/huamao_05.png" alt="" class="dp_right" />
				</div>
				<div class='j-dorpdown-layer foucs-list ZZHT-cart-box' style="height:0;margin:0;">
					<div class="ZZHT-cart-boxs" style="margin-top:0;top:0;">
						<div id="list-carts" class="clearfix">
							<div style="padding:32px 0px 77px 112px;"><img src="../plugin/layer/default/loading-0.gif" style="vertical-align: middle;">正在加载数据...</div>
						</div>
						<div id="list-carts2" class="clearfix">
							<!--<p class="carts">购物车中空空如也，赶紧去选购吧～</p>-->
						</div>
						<div id="list-carts3" class="clearfix"></div>
						<div class="ZZHT-clear"></div>
					</div>
				</div>
			</li>
		</ul>
		<div class="ZZHT-clear"></div>
	</div>
</div>
<script type="text/javascript" src="../js/qrcode.js"></script>
<script type="text/javascript">
	
	if(localStorage.userId) {
		$('.userType_content div').hide();
		
		$('.go_login').hide();
		$('.go_register').hide();
		$('.user_name').show();
		$('.go_out').show();
		$('.user_name span').html(localStorage.loginName);

		var info = JSON.parse(localStorage.userInfo);
//		console.log(info);
		if(info.isAgent == 1) {//代理公司
			$('.userType_content div').eq(2).show();
		}
		$.ajax({//获取用户状态
			type: "get",
			url: SURL + "users/userIdentity",
			async:false,
			data: {
				"userId":localStorage.userId,
			},
			dataType: 'json',
			success: function(res) {
//				console.log(res);
				if(res.messageCode==200){
					var sauditStatus = res.entity;
					if(sauditStatus.shopStatus == 1) {
						$('.userType_content div').eq(0).show();
					}
					if(sauditStatus.applyStatus == 3) {
						$('.userType_content div').eq(1).show();
					}
				}else{
					layer.msg(res.message);
				}
			}
		});
	} else {
		$('.go_login').show();
		$('.go_register').show();
		$('.user_name').hide();
		$('.go_out').hide();
	}

	$('.go_out').click(function() {
		//	layer.confim({icon:3,function(index){
		//		localStorage.clear();
		//		window.location.reload();
		//	}})
//		layer.confirm('是否退出登录？', {
//			btn: ['退出', '取消'] //按钮
//		}, function() {
			logout();
//		}, function() {
//
//		});
	})

	$('.j-dorpdown').hover(function() {
		$(this).children('.drop-down').children('a').attr('style','color:#000;');
		$(this).children('.j-dorpdown-layer').show();
	}, function() {
		$(this).children('.j-dorpdown-layer').hide();
		$(this).children('.drop-down').children('a').attr('style','');
	});

	$(function() {
		//二维码
		//参数1表示图像大小，取值范围1-10；参数2表示质量，取值范围'L','M','Q','H'
		var a = qrcode(8, 'M');
		var url = 'http://www.baidu.com';
		a.addData(url);
		a.make();
		$('#qrcodea').html(a.createImgTag());
	});
	//header_end
	
	//购物车
	$('.box').hover(function() {
		$(this).children().children('.ZZHT-cart-boxs').show();
		changeCart();
	}, function() {
		$(this).children().children('.ZZHT-cart-boxs').hide();
	});
	
	var changeCart = function() {
		$('#list-carts3').html('');
		$.get(SURL + "sktCarts/selectCartsByuserId", {userId: localStorage.userId,isDirect:0}, function(data) {
			var json = data;
			if(json.messageCode == 200) {
				var json = json.entity;
				$('.goodsNum').html(json.length);
				if(json.length > 0) {
					var htmla = '<div class="clearfix" id="list-comm" style="text-align:center;">&nbsp;&nbsp;共<span>' +json.length + '</span>件商品 </div>';
					$('#list-carts2').html(htmla);
					$('#list-carts3').html('<a href="../carts/carts2.html" class="btn btn-3">去购物车结算</a>');
					var html = '';	
					for(var i=0;i<json.length;i++){
						var shopPrice = json[i].specPrice || json[i].shopPrice;
						shopPrice = returnFloat(shopPrice);
						var img = json[i].goodsImg;
						if(img.substr(0,4)!='http'){
							img = imgUrl+img;
						}
						if(i<3){//显示前三件商品
							html+='<div class="goods" id="j-goods"'+json[i].cartId+'">'
							   	+'<div class="imgs"><a href=""><img class="goodsImgc" src="'+img+'" title=""></a></div>'
							   	+'<div class="number">'
							   	+	'<p><a  href="">'+json[i].goodsName+'</a></p>'
//							   	+	'<p>数量：'+json[i].cartNum+'</p>'
							   	+'</div>'
							   	+'<div class="price"><p>&yen;'+shopPrice+'</p></div>'
							+'</div>';
						}
					}
					$('#list-carts').html(html);
				} else {
					$('#list-carts').html('<p class="carts">购物车中空空如也，赶紧去选购吧～</p>');
				}
			}
		});
	};
	changeCart();
	//购物车__end
</script>